using System.ComponentModel;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Be.Timvw.Framework.ComponentModel
{
    [TestClass]
    public class WhenDeterminingIsSortedOnInSortableBindingLists
    {
        [TestMethod]
        public void ShouldReturnFalseWhenNotSorted()
        {
            IBindingList bindingList = SortableBindingListFactory.Create();
            Assert.IsFalse(bindingList.IsSorted);
        }

        [TestMethod]
        public void ShouldReturnTrueWhenSorted()
        {
            IBindingList bindingList = SortableBindingListFactory.Create();
            PropertyDescriptor propertyDescriptor = PropertyDescriptorHelper.Get(bindingList[0], "Id");
            bindingList.ApplySort(propertyDescriptor, ListSortDirection.Ascending);

            Assert.IsTrue(bindingList.IsSorted);
        }
    }
}